﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebSite.Master" AutoEventWireup="true"
    CodeBehind="EnterpriseMachineInfoList.aspx.cs" Inherits="RN.ERP.Web.Enterprise.EnterpriseMachineInfoList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript" src="../Scripts/EnterpriseCorpList.js"></script>
    <script type="text/javascript">
        $(function () {
            //查询
            $("#btnSearch").click(function () {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
            }
            );

            //删除选择的数据
            $("#btnDel").click(function () {
                var chk = $("input:checked");
                if (chk.length == 0) {
                    $.ligerDialog.warn("请选择要删除的机械设备！");
                    return false;
                }
                if (chk.length > 1) {
                    $.ligerDialog.warn("请选择一项机械设备进行删除！");
                    return false;
                }
                var id = chk.attr("value");
                var pageData = {};
                pageData.action = "MachineInfoDel";
                pageData.id = id;
                $.getJSON("../Handlers/EnterpriseCorpInfoHandler.ashx", pageData, function (data) {
                    $.ligerDialog.warn(data.Message);
                });
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
            });
        }
);
        //编辑选择的数据
        function CheckSel() {
            var chk = $("input:checked");
            if (chk.length == 0) {
                $.ligerDialog.warn("请选择要编辑的机械设备！");
                return false;
            }
            if (chk.length > 1) {
                $.ligerDialog.warn("请选择一项机械设备进行编辑！");
                return false;
            }
            var id = chk.attr("value");
            var macGuid = chk.attr("var2");
            window.location = "EnterpriseMachineinfo.aspx?status=2&mid=" + id + "&MacGuid=" + macGuid;
        }
        //查看选择的数据
        function ShowCorpView(id, macGuid) {
            window.location = "EnterpriseMachineinfo.aspx?status=1&mid=" + id + "&MacGuid=" + macGuid;
        }
        function RefreshGrid(condition) {
            $("#<%= hdnCondition.ClientID %>").val(condition);
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }
    </script>
    <style type="text/css">
        .text_css
        {
            border: 2px;
            height: 24px;
            line-height: 24px;
            margin-top: 8px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ListMachines" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="table-layout: fixed;">
        <tr>
            <td class="xx_m  tt_xx_l">
            </td>
            <td class="xx_m  tt_xx_icon">
            </td>
            <td style="width: auto;" class="xx_m">
                机械设备列表
            </td>
            <td style="width: 14px;">
                <img src="../images/xx_r.jpg" width="14" height="33" />
            </td>
        </tr>
        <tr>
            <td class="left_con">
                &nbsp;
            </td>
            <td colspan="2" style="padding-left: 6px; padding-right: 6px;" valign="top">
                <!--#机械设备列表-->
                <div>
                    <div class="xian">
                        <div class="about_title">
                            机械设备列表</div>
                        <div class="i-con-cn">
                            <input type="button" class="xtbiao" id="btnDel" value="删除" />
                            <input type="button" class="xtbiao" id="btnEdit" onclick="CheckSel()" value="编辑" />
                            <a href="../Enterprise/EnterpriseMachineinfo.aspx?status=0" class="xtbiao">添加</a>
                            <input type="button" class="xtbiao" id="btnSearch" value="查询" />
                        </div>
                    </div>
                    <asp:Panel ID="Panel1" runat="server" Style="margin-bottom: 5px;">
                        <table style="width: 100%; height: 40px; padding-bottom: 10px; padding-top: 10px;
                            background-color: #eaeaea; text-align: center;">
                            <tr>
                                <td width="80">
                                    自有或租赁
                                </td>
                                <td width="">
                                    <div>
                                        <span class="input_l">
                                            <img src="../images/input_l.jpg" width="10" height="31" alt="" /></span> <span style="height: 31px;
                                                background: url(../images/input_m.jpg) repeat-x; float: left; overflow: hidden">
                                                <asp:DropDownList ID="ddlIsOwn" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlIsOwn_OnSelectedIndexChanged"
                                                    Style="width: 100px; height: 20px; line-height: 31px; margin-top: 5px; border: 0;">
                                                    <asp:ListItem Value="-1">全部</asp:ListItem>
                                                    <asp:ListItem Value="1">自有</asp:ListItem>
                                                    <asp:ListItem Value="0">租赁</asp:ListItem>
                                                </asp:DropDownList>
                                            </span><span class="input_r">
                                                <img src="../images/input_r.jpg" width="10" height="31" alt="" /></span>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <telerik:RadGrid ID="ListMachines" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                        Width="100%" Culture="zh-CN" GridLines="None" AllowFilteringByColumn="false"
                        AllowPaging="true" AllowCustomPaging="true" AllowMultiRowSelection="true" OnNeedDataSource="ListMachines_NeedDataSource"
                        AllowSorting="false" ShowStatusBar="true">
                        <ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" EnableRowHoverStyle="true">
                            <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
                                AllowColumnResize="True"></Resizing>
                        </ClientSettings>
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="ID">
                            <CommandItemSettings ExportToPdfText="导出PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                            </RowIndicatorColumn>
                            <Columns>
                                <telerik:GridTemplateColumn HeaderText="选择" HeaderStyle-Width="50px">
                                    <ItemTemplate>
                                        <input id="ckb" type="checkbox" value='<%#Eval("ID")%>' var2='<%#Eval("MacGuid") %>'
                                            runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle Width="50px"></ItemStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn DataField="ID" HeaderText="ID" UniqueName="ID" ReadOnly="true"
                                    Visible="false">
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn DataField="MachineName" HeaderText="设备名称">
                                    <ItemTemplate>
                                        <a href="javascript:void(0);" onclick="ShowCorpView('<%#Eval("ID") %>','<%#Eval("MacGuid") %>')">
                                            <span style="color: #43a9f5">
                                                <%#Eval("MachineName")%></span></a>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="ModelNumber" HeaderText="型号" ItemStyle-Width="100px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ProductionPlace" HeaderText="产地" HeaderStyle-Width="100px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ReleaseDate" HeaderText="出厂日期" HeaderStyle-Width="200px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Quantity" HeaderText="数量" HeaderStyle-Width="60px">
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn DataField="IsOwn" HeaderText="自有或租赁" HeaderStyle-Width="200px">
                                    <ItemTemplate>
                                        <%#Eval("IsOwn").ToString() == "False" ? "租赁" :"自有" %>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings EnableRowHoverStyle="true">
                        </ClientSettings>
                        <PagerStyle AlwaysVisible="True" />
                        <FilterMenu EnableImageSprites="False">
                        </FilterMenu>
                    </telerik:RadGrid>
                </div>
                <!--#机械设备列表结束-->
            </td>
            <td class="right_con">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="con_m tt_left_bottom">
                &nbsp;
            </td>
            <td colspan="2" class="con_m">
                &nbsp;
            </td>
            <td class="tt_right_bottom">
                &nbsp;
            </td>
        </tr>
    </table>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue" EnableShadow="true">
    </telerik:RadWindowManager>
    <asp:HiddenField ID="hdnClassID" runat="server" />
    <asp:HiddenField ID="hdnCondition" runat="server" />
</asp:Content>
